<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:v-on="http://www.w3.org/1999/xhtml">

	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<title>小K服务后台管理系统--系统日志</title>
		<meta name="keywords" content="">
		<meta name="description" content="">

		<link rel="shortcut icon" href="../../../../static/favicon.ico" th:href="@{/favicon.ico}">

		<link rel="stylesheet" type="text/css" href="../../../../static/bootstrap/css/bootstrap.min.css" th:href="@{/bootstrap/css/bootstrap.min.css}" />
		<link rel="stylesheet" type="text/css" href="../../../../static/plugins/iCheck/custom.css" th:href="@{/plugins/iCheck/custom.css}" />
        <link rel="stylesheet" type="text/css" href="../../../../static/plugins/switchery/switchery.css" th:href="@{/plugins/switchery/switchery.css}" />
        <link rel="stylesheet" type="text/css" href="../../../../static/plugins/layui/css/layui.css" th:href="@{/plugins/layui/css/layui.css}" />
        <link rel="stylesheet" type="text/css" href="../../../../static/web/admin/css/font-awesome.css" th:href="@{/web/admin/css/font-awesome.css}" />
        <link rel="stylesheet" type="text/css" href="../../../../static/web/admin/css/animate.css" th:href="@{/web/admin/css/animate.css}" />
        <link rel="stylesheet" type="text/css" href="../../../../static/web/admin/css/style.css" th:href="@{/web/admin/css/style.css}" />

	</head>

	<body class="gray-bg">
		<div class="wrapper wrapper-content animated fadeInRight" id="body">
			<div class="row">
				<div class="col-sm-12">
					<div class="ibox float-e-margins">
						<div class="ibox-title">
							<h5>系统日志 <small>管理员操作日志</small></h5>
						</div>
						<div class="ibox-content">
							<div class="row">
								<div class="col-sm-9 m-b-xs">

									<div class="btn-group" id="exampleToolbar" role="group">
										<div class="btn-group">
											<button data-toggle="dropdown" class="btn btn-white dropdown-toggle">过滤系统日志类型 <span class="caret"></span>
											</button>
											<ul class="dropdown-menu">
												<li>
													<a href="javascript:void(0);" v-on:click="show(1)">用户日志</a>
												</li>
												<li>
													<a href="javascript:void(0);" v-on:click="show(2)">管理员日志</a>
												</li>
                                                <li class="divider"></li>
												<li>
													<a href="javascript:void(0);" v-on:click="show(0)">全部日志</a>
												</li>
											</ul>
										</div>
									</div>

								</div>
								<div class="col-sm-3">
									<div class="input-group">
										<input type="text" v-model="pageInfo.search" placeholder="请输入关键词" class="input-sm form-control"> <span class="input-group-btn">
                                        <button type="button" class="btn btn-sm btn-primary"  v-on:click="searchUser"> 搜索</button> </span>
									</div>
								</div>
							</div>
							<div>
								<table class="table table-hover table-bordered">
									<thead>
										<tr>
											<th style="width: 150px;">操作时间</th>
											<th style="width: 100px;">操作人</th>
											<th>操作内容</th>
										</tr>
									</thead>
									<tbody>
										<tr v-for="(item,index) in list">
											<td>{{item.addTime}}</td>
											<td>{{item.name}}</td>
											<td>{{item.actionText}}</td>
										</tr>
										<tr v-if="!list || list.length == 0" style="text-align: center;"><td colspan="3">没有更多内容</td></tr>
									</tbody>
								</table>
							</div>
							<div id="page"></div>
						</div>
					</div>
				</div>

			</div>

		</div>
		
		<script src="../../../../static/plugins/jquery.min.js" th:src="@{/plugins/jquery.min.js}" type="text/javascript" charset="utf-8"></script>
		<script src="../../../../static/bootstrap/js/bootstrap.min.js" th:src="@{/bootstrap/js/bootstrap.min.js}" type="text/javascript" charset="utf-8"></script>
		<script src="../../../../static/plugins/vuejs/vue.min.js" th:src="@{/plugins/vuejs/vue.min.js}" type="text/javascript" charset="utf-8"></script>
		<script src="../../../../static/plugins/layui/layui.js" th:src="@{/plugins/layui/layui.js}" type="text/javascript" charset="utf-8"></script>
		<script src="../../../../static/plugins/switchery/switchery.js" th:src="@{/plugins/switchery/switchery.js}" type="text/javascript" charset="utf-8"></script>
        <script src="../../../../static/plugins/peity/jquery.peity.min.js" th:src="@{/plugins/peity/jquery.peity.min.js}" type="text/javascript" charset="utf-8"></script>
        <script src="../../../../static/plugins/iCheck/icheck.min.js" th:src="@{/plugins/iCheck/icheck.min.js}" type="text/javascript" charset="utf-8"></script>
        <script src="../../../../static/web/admin/js/content.js" th:src="@{/web/admin/js/content.js}" type="text/javascript" charset="utf-8"></script>
        <script src="../../../../static/URL.js" th:src="@{/URL.js}"></script>

		<script>
            layui.use(['layer', 'laypage', 'laydate'], function(){
                var layer = layui.layer //获得layer模块
                    ,laypage = layui.laypage //获得laypage模块
                    ,laydate = layui.laydate; //获得laydate模块
                //使用模块
                var app = new Vue({
                    el: '#body',
                    data: {
                        list: [],
                        pageInfo:{
                            page:1,
                            show:0,
                            search:""
                        }
                    },
                    methods: {
                        searchUser: function() {
                            this.loadPage(1);
                        },
                        show:function (show) {
                            this.pageInfo.show=show;
                            this.loadPage(1);
                        },
                        loadPage: function(page) {
                            if(page === undefined) {
                                // 重新加载当前页面
                            }else if(page * 1 < 1) {
                                this.pageInfo.page=1;
                            }else {
                                this.pageInfo.page=page;
                            }
                            $.ajax({
                                type: "get",
                                data:app.pageInfo,
                                url: AjaxUrl.admin.logging.list,
                                async: true,
                                dataType: "json",
                                success: function(data) {
                                    if(data.code === 0){
                                        layui.layer.msg(data.msg);
                                        app.list = data.list;
                                        layui.laypage.render({
                                            elem: "page",
                                            count:data.count,
                                            limit:10,
                                            curr: data.pageCurr,
                                            groups: 10,
                                            jump: function(obj, first) {
                                                //得到了当前页，用于向服务端请求对应数据
                                                var curr = obj.curr;
                                                if(!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
                                                    app.loadPage(curr);
                                                }
                                            }
                                        });
                                    }else {
                                        layui.layer.msg(data.msg, {time: 20000, btn: ['明白了']});
                                    }
                                },
                                error:function () {
                                    layui.layer.msg("加载错误", {time: 5000, btn: ['明白了']});
                                }
                            });
                        }
                    }
                });
                app.loadPage(1);
            });

        </script>
	</body>

</html>